(bug 25877) Don't focus search box when clicking SimpleSearch's magnifying class...
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 11 Nov 2010 10:15:49 +0000 (10:15 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 11 Nov 2010 10:15:49 +0000 (10:15 +0000)
resources/jquery/jquery.placeholder.js

index f445224..7390b9e 100644 (file)
@@ -37,7 +37,14 @@ jQuery.fn.placeholder = function( text ) {
                                // Blank on submit -- prevents submitting with unintended value
                                .parents( 'form' )
                                        .bind( 'submit', function() {
-                                               $input.trigger( 'focus' );
+                                               // $input.trigger( 'focus' ); is problematic
+                                               // because it actually focuses $input, leading
+                                               // to nasty behavior in mobile browsers
+                                               if ( $input.hasClass( 'placeholder' ) ) {
+                                                       $input
+                                                               .val( '' )
+                                                               .removeClass( 'placeholder' );
+                                               }
                                        } );
                        // Show initially, if empty
                        if ( $input.val() == '' ) {